package org.alvin.i18n.ui;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.github.houbb.opencc4j.util.ZhConverterUtil;

import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;

public class CWordToTw {

    public static void main1(String[] args) throws IOException {
        File dir = new File("D:\\quanda");
        File sourceDir = new File(dir, "zh");
        File distDir = new File(dir, "zhhk");
        distDir.mkdirs();
        for (File f : sourceDir.listFiles()) {
            byte[] buff = Files.readAllBytes(Paths.get(f.getAbsolutePath()));
            File tmpDir = new File(distDir, f.getName());
            String text = ZhConverterUtil.toTraditional(new String(buff));
            Files.write(Paths.get(tmpDir.getAbsolutePath()), text.getBytes(StandardCharsets.UTF_8));
        }
    }

    public static void main(String[] args) throws IOException {
        byte[] buff = Files.readAllBytes(Paths.get("D:/i18n.js"));
        File tmpDir = new File("D:/i18nzhhk.js");
        String text = ZhConverterUtil.toTraditional(new String(buff));
        Files.write(Paths.get(tmpDir.getAbsolutePath()), text.getBytes(StandardCharsets.UTF_8));
    }
}
